package util.date;


import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * <p>Title:DateFormatThreadLocal </p>
 * <p>Description: 线程安全时间格式化</p>
 * <p>Company:Software College </p>
 *
 * @author SuccessKey(WangCJ)
 * @date 2017年6月21日 上午9:21:21
 */
public class DateFormatThreadLocal {

    private static final ThreadLocal<DateFormat> THREAD_DF = new ThreadLocal<DateFormat>() {

        @Override
        public DateFormat initialValue() {
            return new SimpleDateFormat("yyyyMMdd");
        }

    };


    public  static final Date convert(String source) throws Exception {
        return THREAD_DF.get().parse(source);
    }
}